<?php

/**
 * Action filter form base class.
 *
 * @package    kc_report_proto
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseActionFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'prj_id'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'act_num'           => new sfWidgetFormFilterInput(),
      'act_libelle'       => new sfWidgetFormFilterInput(),
      'act_categorie'     => new sfWidgetFormFilterInput(),
      'act_type'          => new sfWidgetFormFilterInput(),
      'act_date_emission' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'act_date_echeance' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'act_etat'          => new sfWidgetFormFilterInput(),
      'act_commentaire'   => new sfWidgetFormFilterInput(),
      'act_acteur'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'prj_id'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'act_num'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'act_libelle'       => new sfValidatorPass(array('required' => false)),
      'act_categorie'     => new sfValidatorPass(array('required' => false)),
      'act_type'          => new sfValidatorPass(array('required' => false)),
      'act_date_emission' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'act_date_echeance' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'act_etat'          => new sfValidatorPass(array('required' => false)),
      'act_commentaire'   => new sfValidatorPass(array('required' => false)),
      'act_acteur'        => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('action_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Action';
  }

  public function getFields()
  {
    return array(
      'act_id'            => 'Number',
      'prj_id'            => 'Number',
      'act_num'           => 'Number',
      'act_libelle'       => 'Text',
      'act_categorie'     => 'Text',
      'act_type'          => 'Text',
      'act_date_emission' => 'Date',
      'act_date_echeance' => 'Date',
      'act_etat'          => 'Text',
      'act_commentaire'   => 'Text',
      'act_acteur'        => 'Text',
    );
  }
}
